/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ReadTorrent;

import CreateTorrent.CreateTorrent;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;

/**
 *
 * @author THANG
 */
public class ReadTorrent {     
        public  String FileStyle = null;
        public  int FileLength = 0;
        public   ArrayList<String> FileName;     
        public ReadTorrent()
        {
           FileStyle = null;
           FileLength = 0;
           FileName = new ArrayList<>();
        }
        public ArrayList ReadFile()
        {
        File file = new File("Jellyfish.toren");
        BufferedReader reader = null;
        String sFileLength =null;
        try
        {
            reader = new BufferedReader(new FileReader(file));
            // repeat until all lines is read
            FileStyle = reader.readLine();
            sFileLength = reader.readLine();
            FileLength= Integer.parseInt(sFileLength);
            for (int i = 0; i < FileLength; i++)
            {
                FileName.add( reader.readLine());
            }
        } catch (FileNotFoundException e)
        {
        } catch (IOException e)
        {
        } finally
        {
            try
            {
                if (reader != null)
                {
                    reader.close();
                }
            } catch (IOException e)
            {
            }
        }
        return FileName;
        }
        
        public ArrayList GetFileName()
        {
            return FileName;
        }
        
        public String GetFileStyle()
        {
            return FileStyle;
        }
        
        public int FileLength()
        {
            return FileLength;
        }
         public static void main(String[] ar)  
         {                  
             ReadTorrent rd = new ReadTorrent();
             rd.ReadFile();
             System.out.println(rd.FileName.get(0));   
             System.out.println(rd.FileName.get(1));
         } 
        
}
